package com.lv.service.bean

import android.os.Parcelable
import androidx.annotation.Keep
import com.chad.library.adapter.base.entity.MultiItemEntity
import com.chad.library.adapter.base.entity.node.BaseExpandNode
import com.chad.library.adapter.base.entity.node.BaseNode
import com.github.gzuliyujiang.wheelview.contract.TextProvider
import com.lv.service.repo.UserInfo
import com.lv.service.room.card.CardAddressBean
import com.lv.service.room.card.CardCategoryBean
import com.lv.service.room.card.CardColorBean
import com.lv.service.room.category.CategoryBean
import com.lv.service.room.category.NewTelCategoryBean
//import com.lv.service.room.category.NewTelCategoryCityBean
import com.lv.service.room.saler.ProfessionalBean
import kotlinx.parcelize.Parcelize

/**
 * 作者： ygx
 * 创建日期：2023/3/10 2:33 PM
 * 签名： 天行健，君子以自强不息；地势坤，君子以厚德载物。
 * -    _              _           _     _   ____  _             _ _
 * -   / \   _ __   __| |_ __ ___ (_) __| | / ___|| |_ _   _  __| (_) ___
 * -  / _ \ | '_ \ / _` | '__/ _ \| |/ _` | \___ \| __| | | |/ _` | |/ _ \
 * - / ___ \| | | | (_| | | | (_) | | (_| |  ___) | |_| |_| | (_| | | (_) |
 * -/_/   \_\_| |_|\__,_|_|  \___/|_|\__,_| |____/ \__|\__,_|\__,_|_|\___/
 * <p>
 * You never know what you can do until you try !
 * ----------------------------------------------------------------
 * 描述：
 */
@Parcelize
data class UserInfoOld(
    val id: String,
    val password: String,
    val logo: String? = null,
    var name: String,
    var nickname: String? = null,
    val txaccid: String,
    val role: String? = null,//role; 经理：Z
    var phone: String,
    var issaler: String,//0 总经办 1 财务 2 业务  3 发行 4 设计部 5 网络部 6 运营部 7 行政
    val txaccidpassword: String,
    var head: String,
    var headid: String,
    var headphone: String,
    var bpro: String,
    var book: String,
    var islogin: String,
    val invitecode: String,
    val invitecodeurl: String,
    val token: String?,
    val refreshtoken: String?,
    val isrecommend: String? = null,
    val updated: Long,
    val created: Long,
    val lastlogin: Long,
    val duty: String? = null,
    val sectionList: PersonsItem? = null,
) : Parcelable

@Keep
data class FindProsBean(
    val address: List<CategoryBean>? = null,
//    val receiptAddress: List<CategoryBean>? = null,
    val category: List<CategoryBean>? = null,//公司分类
    val telAddress: List<CardAddressBean>? = null,
    val spuCategory: List<CardCategoryBean>? = null,//商品分类
    val telCategory: List<CardCategoryBean>? = null,//
//    val newreceiptAddress: List<ReceiptAddressItem>? = null,//
//    val backImage: List<CardBackImageBean>? = null,
    val cardColor: List<CardColorBean>? = null,
    val professional: List<ProfessionalBean>? = null,
    val issuer: List<ProfessionalBean>? = null,
    val periods: List<PeriodProBean>? = null,
    val adname: List<ADNameBean>? = null,
    val head: HeadBean? = null,
    val role: RoleBean? = null,
    val url: String? = null,
    val nearByProvince: List<NewTelCategoryBean>? = null,
    val nearByCity: List<NewTelCategoryBean>? = null,
)

//@Keep
//data class NewtelCategoryBean(
//    val nearByProvince: List<NewTelCategoryItemBean>? = null,
//    val nearByCity: List<NewTelCategoryItemBean>? = null,
//)
//@Parcelize
//@Keep
//data class NewTelCategoryItemBean(
//    val id: String,
//    val fcaid: Int,
//    val name: String?,
//    val seq: Int,
//    val image: String?,
//    var isSelcted: Boolean,
//) : Parcelable, TextProvider {
//    override fun provideText(): String {
//        return name ?: ""
//    }
//}

@Parcelize
@Keep
class PersonTitleModel(
    var type: Int = NO_TITLE,
    var info: String,
    var data: PersonBean,
    var slidePosition: Int? = null
) : MultiItemEntity,
    Parcelable {
    companion object {
        const val TITLE = 0
        const val NO_TITLE = 1

    }

    override val itemType: Int
        get() = type

}

@Keep
data class RootNode(
    var isTitle: Boolean = false,//是否是经理
    var isFrist: Boolean = false,//是否是该组第一个经理
    var isLast: Boolean = false,//是否是该组最后一个经理
    var childNodes: List<BaseNode>?,
    val id: String,
    val userid: String,
    val name: String,
    val logo: String,
    var bpro: String,
    var show: String,//部门与地区
    val phone: String,
    val condition: String,
    val duty: String,
    val issaler: String,//0
    val headid: String,
    val head: String,
    val section: String,
    val seq: Int,
    val role: String,//
    val islogin: String,//
//    val sectionName: String? = null,//
    val created: Long,

    ) : BaseExpandNode() {
//    init {
//        this.password = password
//    }

    override val childNode: MutableList<BaseNode>?
        get() = childNodes as MutableList<BaseNode>

    fun getPerson(): PersonBean {
        return PersonBean(
            id, userid, name, logo, bpro, show, phone, condition,
            duty, issaler, headid, head, section, seq, islogin, role, created
        )
    }
}


@Parcelize
@Keep
data class PersonBean(
    val id: String,
    val userid: String,
    val name: String,
    val logo: String,
    var bpro: String,//负责范围
    var show: String,//部门与地区
    val phone: String,
    val condition: String,
    val duty: String,//0 总经理 1 经理 2 成员
    val issaler: String,//部门ID
    val headid: String,
    val head: String,
    val section: String,
    val seq: Int,
    var role: String,
    val islogin: String,//0 不可登录 1 可登录
    val created: Long,
    var isLast: Boolean = false,//是否是该组最后一个成员
    var isSelected: Boolean = false,//是否选中 自定义
//    var firstChat: String? = null,
//    var slidePosition: Int? = null

) : Parcelable, BaseNode() {
    override val childNode: MutableList<BaseNode>?
        get() = null
}

//@Parcelize
//@Keep
//data class ItemNode(
//    var img: Int, var name: String,
//) : Parcelable, BaseNode() {
//    override val childNode: MutableList<BaseNode>?
//        get() = null
//}

@Parcelize
@Keep
data class SpuInfoBean(
    val attribute: List<String>?,
    val category: List<CategoryBean>?,
) : Parcelable

@Parcelize
@Keep
data class HeadBean(
    val financeManager: List<UserInfo>?,
    val issuerManager: List<UserInfo>?,
    val marketManager: List<UserInfo>?,
) : Parcelable

@Parcelize
@Keep
data class RoleBean(
    val market: String,//业务经理权限
    val allrole: String,//所有权限
    val issuer: String,//发行经理权限
    val finance: String,//财务经理权限
) : Parcelable


class PersonDatas : ArrayList<PersondSubList>()

@Parcelize
@Keep
data class PersondSubList(
    var section: String,
    var personnel: List<PersonItem>
) : Parcelable

class PersonnelBeans : ArrayList<PersonItem>()

@Parcelize
@Keep
data class PersonItem(
    val manager: PersonBean?,
    val member: List<PersonBean>? = null
) : Parcelable

@Parcelize
@Keep
data class PersonsItem(
    val manager: List<PersonBean>? = null,
    val member: List<PersonBean>? = null
) : Parcelable

@Parcelize
@Keep
data class TeamItems(
    val manager: List<PersonBean>? = null,
    val othermanager: List<PersonBean>? = null//下
) : Parcelable


@Parcelize
@Keep
data class PersonSamplePage(
    var counts: Int,
    val page: Int,
    val pagesize: Int,
    val pages: Int,
    val items: List<PersonSampleItem>?,
) : Parcelable

@Parcelize
@Keep
data class PersonManagerBean(
    val id: String,
    val section: String,
    val member: List<PersonBean>?,
) : Parcelable

@Keep
class PersonManagerBeans : ArrayList<PersonManagerBean>()

@Parcelize
@Keep
data class PersonSampleItem(
    val id: String,
    val userid: String,
    val name: String,
    val logo: String,
    val duty: String,//0 总经理 1 经理 2 成员
    val phone: String,
    val role: String? = null,
) : Parcelable

@Parcelize
@Keep
data class PeriodProBean(
    var periods: String,
    var book: String,
) : Parcelable

@Parcelize
@Keep
data class ADNameBean(
    var id: String?,
    var position: String?,
    var name: String?,
) : Parcelable




